home *** CD-ROM | disk | FTP | other *** search
/ CICA 32 1998 April / CICA32 (April 1998) (Disc 4 of 4).iso / utils / unzip531.tgz / unzip531.tar / beos / Makefile < prev    next >
Makefile  |  1997-05-31  |  9KB  |  307 lines

  1. #==============================================================================
  2. # Makefile for UnZip, UnZipSFX and fUnZip:  BeOS
  3. # Version:  5.31                                                    25 May 1997
  4. #==============================================================================
  5.  
  6. # INSTRUCTIONS (such as they are):
  7. #
  8. # "make list" - lists all supported compilers (targets)
  9. # "make foo"  - makes UnZip in current directory using the foo compiler
  10. #
  11. # CF are flags for the C compiler.  LF are flags for the loader.  LF2 are more
  12. # flags for the loader, if they need to be at the end of the line instead of at
  13. # the beginning (for example, some libraries).  FL and FL2 are the corre-
  14. # sponding flags for fUnZip.  LOCAL_UNZIP is an environment variable that can
  15. # be used to add default C flags to your compile without editing the Makefile
  16. # (e.g., -DDEBUG_STRUC, or -FPi87 on PCs using Microsoft C).
  17. #
  18. # Be sure to test your new UnZip (and UnZipSFX and fUnZip); successful compila-
  19. # tion does not always imply a working program.
  20. #
  21. # You might want to go down to the "installation" section and set the prefix
  22. # to something else; not everyone is as strange as me, and you might not want
  23. # to put your Info-ZIP executables in /boot/usr/local/bin.  [cjh]
  24.  
  25. all:
  26.     @echo ''
  27.     @echo 'Make what?  You must say what compiler you want to use -- '
  28.     @echo 'for example, "make -f beos/Makefile mwcc".'
  29.     @echo ''
  30.     @echo 'The supported compilers are:'
  31.     @echo ''
  32.     @echo '     gcc     GNU C'
  33.     @echo '     mwcc    Metrowerks CodeWarrior'
  34.     @echo ''
  35.  
  36. list: all
  37.  
  38. #####################
  39. # MACRO DEFINITIONS #
  40. #####################
  41.  
  42. MAKE = make -j 2 -f beos/Makefile
  43.  
  44. # Defaults most systems use (use LOCAL_UNZIP in environment to add flags,
  45. # such as -DDOSWILD).
  46.  
  47. # UnZip flags
  48. MW_CC  = mwcc
  49. GNU_CC = gcc
  50.  
  51. LD = $(CC)
  52. LOC = $(LOCAL_UNZIP) -DPASSWD_FROM_STDIN
  53. AF = $(LOC)
  54.  
  55. # -ansi strict doesn't work with the AADR9 stdio.h... d'oh!
  56. #MW_CF = -w9 -ansi strict -O7 -rostr -I. $(LOC)
  57. MW_CF = -w9 -O7 -rostr -I. $(LOC)
  58. MW_LF = -o unzip
  59. MW_LF2 =
  60.  
  61. GNU_CF = -Wall -ansi -mcpu=604 -O3 -I. $(LOC)
  62. GNU_LF = -o unzip
  63. GNU_LF2 =
  64.  
  65. # UnZipSFX flags
  66. SL = -o unzipsfx
  67. SL2 = $(LF2)
  68.  
  69. # fUnZip flags
  70. FL = -o funzip
  71. FL2 = $(LF2)
  72.  
  73. # general-purpose stuff
  74. CP = cp
  75. RM = rm -f
  76. LN = ln -sf
  77. E =
  78. O = .o
  79. M = beos
  80. SHELL = /bin/sh
  81.  
  82. # defaults for crc32 stuff and system-dependent headers
  83. CRC32 = crc32
  84. OSDEP_H = beos/beos.h
  85.  
  86. # object files
  87. OBJS1 = unzip$O $(CRC32)$O crctab$O crypt$O envargs$O explode$O
  88. OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O
  89. OBJS3 = process$O ttyio$O unreduce$O unshrink$O zipinfo$O
  90. OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O
  91. LOBJS = $(OBJS)
  92. OBJSDLL = $(OBJS) api$O
  93. OBJX = unzipsfx$O $(CRC32)$O crctab$O crypt$O extract_$O fileio$O globals$O \
  94.     inflate$O match$O process_$O ttyio$O $M_$O
  95. LOBJX = $(OBJX)
  96. OBJF = funzip$O $(CRC32)$O crypt_$O globals_$O inflate_$O ttyio_$O
  97. UNZIP_H = unzip.h unzpriv.h globals.h $(OSDEP_H)
  98.  
  99. # installation
  100. INSTALL = install
  101. # on some systems, manext=l and MANDIR=/usr/man/man$(manext) may be appropriate
  102. manext = 1
  103. prefix = /boot/usr/local
  104. BINDIR = $(prefix)/bin#            where to install executables
  105. MANDIR = $(prefix)/man/man$(manext)#    where to install man pages
  106. INSTALLEDBIN = $(BINDIR)/funzip$E $(BINDIR)/zipinfo$E $(BINDIR)/unzipsfx$E \
  107.     $(BINDIR)/unzip$E
  108. INSTALLEDMAN = $(MANDIR)/unzip.$(manext) $(MANDIR)/funzip.$(manext) \
  109.     $(MANDIR)/unzipsfx.$(manext) $(MANDIR)/zipinfo.$(manext)
  110. #
  111. UNZIPS = unzip$E funzip$E unzipsfx$E zipinfo$E
  112. # this is a little ugly...well, no, it's a lot ugly:
  113. MANS = unix/unzip.1 unix/unzipsfx.1 unix/zipinfo.1 unix/funzip.1
  114. DOCS = unzip.doc unzipsfx.doc zipinfo.doc funzip.doc
  115.  
  116. ###############################################
  117. # BASIC COMPILE INSTRUCTIONS AND DEPENDENCIES #
  118. ###############################################
  119.  
  120. # this is for GNU make; comment out and notify zip-bugs if it causes errors
  121. .SUFFIXES:    .c .o
  122.  
  123. # default for compiling C files
  124. .c.o:
  125.     $(CC) -c $(CF) $*.c
  126.  
  127.  
  128. unzips:        $(UNZIPS)
  129. objs:        $(OBJS)
  130. objsdll:    $(OBJSDLL)
  131. docs:        $(DOCS)
  132. unzipsman:    unzips docs
  133. unzipsdocs:    unzips docs
  134.  
  135.  
  136. unzip$E:    $(OBJS)
  137.     $(LD) $(LF) $(LOBJS) $(LF2)
  138.  
  139. unzipsfx$E:    $(OBJX)
  140.     $(LD) $(SL) $(LOBJX) $(SL2)
  141.  
  142. funzip$E:    $(OBJF)
  143.     $(LD) $(FL) $(OBJF) $(FL2)
  144.  
  145. zipinfo$E:    unzip$E
  146.     $(LN) unzip$E zipinfo$E
  147.  
  148.  
  149. crc32$O:    crc32.c $(UNZIP_H) zip.h
  150. crctab$O:    crctab.c $(UNZIP_H) zip.h
  151. crypt$O:    crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
  152. envargs$O:    envargs.c $(UNZIP_H)
  153. explode$O:    explode.c $(UNZIP_H)
  154. extract$O:    extract.c $(UNZIP_H) crypt.h
  155. fileio$O:    fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h
  156. funzip$O:    funzip.c $(UNZIP_H) crypt.h ttyio.h tables.h
  157. globals$O:    globals.c $(UNZIP_H)
  158. inflate$O:    inflate.c inflate.h $(UNZIP_H)
  159. list$O:        list.c $(UNZIP_H)
  160. match$O:    match.c $(UNZIP_H)
  161. process$O:    process.c $(UNZIP_H)
  162. ttyio$O:    ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  163. unreduce$O:    unreduce.c $(UNZIP_H)
  164. unshrink$O:    unshrink.c $(UNZIP_H)
  165. unzip$O:    unzip.c $(UNZIP_H) crypt.h version.h consts.h
  166. zipinfo$O:    zipinfo.c $(UNZIP_H)
  167.  
  168. crypt_$O:    crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h    # funzip only
  169.     $(CP) crypt.c crypt_.c
  170.     $(CC) -c $(CF) -DFUNZIP crypt_.c
  171.     $(RM) crypt_.c
  172.  
  173. extract_$O:    extract.c $(UNZIP_H) crypt.h            # unzipsfx only
  174.     $(CP) extract.c extract_.c
  175.     $(CC) -c $(CF) -DSFX extract_.c
  176.     $(RM) extract_.c
  177.  
  178. globals_$O:    globals.c $(UNZIP_H)                # funzip only
  179.     $(CP) globals.c globals_.c
  180.     $(CC) -c $(CF) -DFUNZIP globals_.c
  181.     $(RM) globals_.c
  182.  
  183. inflate_$O:    inflate.c inflate.h $(UNZIP_H) crypt.h        # funzip only
  184.     $(CP) inflate.c inflate_.c
  185.     $(CC) -c $(CF) -DFUNZIP inflate_.c
  186.     $(RM) inflate_.c
  187.  
  188. ttyio_$O:    ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h    # funzip only
  189.     $(CP) ttyio.c ttyio_.c
  190.     $(CC) -c $(CF) -DFUNZIP ttyio_.c
  191.     $(RM) ttyio_.c
  192.  
  193. process_$O:    process.c $(UNZIP_H)                # unzipsfx only
  194.     $(CP) process.c process_.c
  195.     $(CC) -c $(CF) -DSFX process_.c
  196.     $(RM) process_.c
  197.  
  198. beos$O:        beos/beos.c $(UNZIP_H) version.h        # BeOS only
  199.     $(CC) -c $(CF) beos/beos.c
  200.  
  201. # version() not used by unzipsfx, so no version.h dependency
  202. beos_$O:        beos/beos.c $(UNZIP_H)                # unzipsfx only
  203.     $(CP) beos/beos.c beos_.c
  204.     $(CC) -c $(CF) -Ibeos -DSFX beos_.c
  205.     $(RM) beos_.c
  206.  
  207. unzipsfx$O:    unzip.c $(UNZIP_H) crypt.h version.h consts.h    # unzipsfx only
  208.     $(CP) unzip.c unzipsfx.c
  209.     $(CC) -c $(CF) -DSFX unzipsfx.c
  210.     $(RM) unzipsfx.c
  211.  
  212.  
  213. # this really only works for Unix targets, unless E and O specified on cmd line
  214. clean:
  215.     -rm -f $(UNZIPS) $(OBJS) $(OBJF) $(OBJX) api$O apihelp$O crc_gcc$O \
  216.       unzipstb$O
  217.  
  218. install:    $(UNZIPS) $(MANS)
  219.     $(INSTALL) -m 755 $(UNZIPS) $(BINDIR)
  220.     $(RM) $(BINDIR)/zipinfo$E
  221.     $(LN) unzip$E $(BINDIR)/zipinfo$E
  222.     $(RM) $(BINDIR)/zipgrep$E
  223.     $(INSTALL) -m 755 unix/zipgrep $(BINDIR)/zipgrep$E
  224.     $(INSTALL) -m 644 unix/unzip.1 $(MANDIR)/unzip.$(manext)
  225.     $(INSTALL) -m 644 unix/unzipsfx.1 $(MANDIR)/unzipsfx.$(manext)
  226.     $(INSTALL) -m 644 unix/zipinfo.1 $(MANDIR)/zipinfo.$(manext)
  227.     $(INSTALL) -m 644 unix/funzip.1 $(MANDIR)/funzip.$(manext)
  228.     $(INSTALL) -m 644 $(DOCS) $(MANDIR)
  229.  
  230. # alternatively, could use zip method:  -cd $(BINDIR); rm -f $(UNZIPS)  [etc.]
  231. uninstall:
  232.     rm -f $(INSTALLEDBIN) $(INSTALLEDMAN)
  233.  
  234.  
  235. TESTZIP = testmake.zip    # the test zipfile
  236.  
  237. # test some basic features of the build
  238. test:        check
  239.  
  240. check:    unzips
  241.     @echo '  This is a Unix-specific target.  (Just so you know.)'
  242.     @echo '  (Should work ok on BeOS... [cjh])'
  243.     if test ! -f $(TESTZIP); then \
  244.         echo "  error:  can't find test file $(TESTZIP)"; exit 1; fi
  245. #
  246.     echo "  testing extraction"
  247.     ./unzip -b $(TESTZIP) testmake.zipinfo
  248.     if test $? ; then \
  249.         echo "  error:  file extraction from $(TESTZIP) failed"; exit 1; fi
  250. #
  251.     echo '  testing zipinfo (unzip -Z)'
  252.     ./unzip -Z $(TESTZIP) > testmake.unzip-Z
  253.     if diff testmake.unzip-Z testmake.zipinfo; then ;; else \
  254.         echo '  error:  zipinfo output doesn't match stored version'; fi
  255.     $(RM) testmake.unzip-Z testmake.zipinfo
  256. #
  257.     echo '  testing unzip -d exdir option'
  258.     ./unzip -b $(TESTZIP) -d testun
  259.     cat testun/notes
  260. #
  261.     echo '  testing unzip -o and funzip (ignore funzip warning)'
  262.     ./unzip -boq $(TESTZIP) notes -d testun
  263.     ./funzip < $(TESTZIP) > testun/notes2
  264.     if diff testun/notes testun/notes2; then ;; else \
  265.         echo 'error:  funzip output disagrees with unzip'; fi
  266. #
  267.     echo '  testing unzipsfx (self-extractor)'
  268.     cat unzipsfx $(TESTZIP) > testsfx
  269.     $(CHMOD) 0700 testsfx
  270.     ./testsfx -b notes
  271.     if diff notes testun/notes; then ;; else \
  272.         echo '  error:  unzipsfx file disagrees with unzip'; fi
  273.     $(RM) testsfx notes testun/notes testun/notes2
  274.     rmdir testun
  275. #
  276.     echo '  testing complete.'
  277.  
  278. ######################################################################
  279. # Make rules for the supported compilers
  280.  
  281. gcc:
  282.     @echo ''
  283.     @echo 'WARNING: GNU C support is completely untested right now!'
  284.     @echo '         It is not likely even to compile yet.'
  285.     @echo ''
  286.     @echo '         You might want to contact chrish@qnx.com to see'
  287.     @echo '         if there are any GNU C patches for UnZip 5.31'
  288.     @echo '         before trying this.'
  289.     @echo ''
  290.     @echo 'Sleeping for 15 seconds so you can read this, then we'll try...'
  291.     @sleep 15s
  292.     @echo ''
  293.     @echo 'Making with GNU C...'
  294.     @echo ''
  295.     $(MAKE) $(UNZIPS) CC=$(GNU_CC) CF="$(GNU_CF)" LF="$(GNU_LF)" \
  296.             LF2="$(GNU_LF2)"
  297.  
  298. mwcc:
  299.     @echo 'Making with Metrowerks CodeWarrior...'
  300.     @echo ''
  301.     $(MAKE) $(UNZIPS) CC=$(MW_CC) CF="$(MW_CF)" LF="$(MW_LF)" \
  302.             LF2="$(MW_LF2)"
  303.  
  304. foo: list
  305.     @echo 'I was kidding about the "foo" compiler.'
  306.     @echo ''
  307.